﻿/// <reference path="~/Scripts/lib/jquery-1.8.3.js" />
/// <reference path="~/Scripts/lib/knockout-2.2.0.js" />

/**
 @title:        vm.workspace
 @description:  ???
 @author:       Yuriy Shapovalov
 */

define("vm.workspace",
	['jquery', 'ko', 'datacontext', 'config', 'router'],
	function ($, ko, datacontext, config, router) {
	    activityItemTemplate = 'common.activityitem',
        timelogTemplate = 'common.timelogtable',
	    activities = ko.observableArray();
	    context = {
	        date: "data comes from workspace vm",
            totalTime: "10.22.12"
	    };
	    addActivity = function () {
            // do nothing
	    }

	    activate = function (routerData, callback) {
            debugger
            refresh(callback);
            console.log(activities)
	    };

	    refresh = function (callback) {
	        getActivities(callback);
	    };
        
        getActivities = function (callback) {
            datacontext.activities.getActivities(activities);
        }
        
        return {
            activate: activate,
            activities: activities,
            addActivity: addActivity,
	        activityItemTemplate: activityItemTemplate,
            timelogTemplate: timelogTemplate
	    }
	});